package com.tw.trips.ui.mock;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import com.tw.trips.domain.Comment;
import com.tw.trips.domain.Location;
import com.tw.trips.domain.Traveller;
import com.tw.trips.domain.Update;

public class UpdateMock {
	public Update getUpdate(String updateTxt,Location forLocation) {
		Update update = new Update();
		update.setMessage(updateTxt);
		update.setCreatedOn(new Date());
		update.setForLocation(forLocation);
		update.setUpdatedBy(getTraveler());
		update.setImgURL("image url");
		update.getComments().addAll((getComments()));
		return update;
	}

	private Set<Comment> getComments() {
		Set<Comment> comments = new HashSet<Comment>();
		for(int i=0; i<10;i++) {
			Comment comment = new Comment();
			
			comment.setMessage("Comment Comment Comment"+i);
			comment.setCreatedOn(new Date());
			comment.setCommentedBy(getTraveler());
			comments.add(comment);
		}
		return comments;
	}

	private Traveller getTraveler() {
		Traveller traveller = new Traveller();
		traveller.setName("Traveler Name");
		return traveller;
	}
}
